<template>
  <div id="app">
    <transition name="fade">
      <keep-alive>
        <component :is="coms[current]">
          <MyShopping></MyShopping>
          <MyDingdan></MyDingdan>
          <MyWode></MyWode>
        </component>
      </keep-alive>
    </transition>

    <div class="foo">
      <span
        v-for="(item, index) in footer"
        :key="index"
        @click="gaoliang(index)"
        :class="{ active: current == index }"
      >
        <div>
          <img
            src="https://img0.baidu.com/it/u=3543744483,3841256984&fm=253&fmt=auto&app=138&f=JPEG?w=300&h=300"
            alt=""
          />
        </div>
        {{ item }}
      </span>
    </div>
  </div>
</template>

<script>
import MyShopping from "./components/MyShopping.vue";
import MyDingdan from "./components/MyDingdan.vue";
import MyWode from "./components/MyWode.vue";

export default {
  components: { MyShopping },
  data() {
    return {
      current: 0,
      footer: ["首页", "订单", "我的"],
      coms: [MyShopping, MyDingdan, MyWode],
    };
  },
  methods: {
    gaoliang(index) {
      this.current = index;
    },
  },
};
</script>

<style lang='scss' scoped>
.fade-enter {
  opacity: 0;
}
.fade-enter-active {
  transition: all 0.8s;
}
.fade-enter-to {
  opacity: 1;
}
.foo {
  width: 100%;
  height: 50px;
  background-color: #fff;
  position: fixed;
  bottom: 0;
  border-top: 1px solid rgba(128, 128, 128, 0.434);
  display: flex;
  align-items: center;
  justify-content: space-around;
}
img {
  width: 25px;
  height: 25px;
  text-align: center;
}
.active {
  color: lightseagreen;
}
.paixu .active {
  color: #ff6a00;
}
.im img {
  width: 100%;
  height: 130px;
}
.lick {
  margin-right: 10px;
}
.paixu {
  margin-top: 10px;
  width: 100%;
  height: 30px;
  // background-color: aqua;
  display: flex;
  justify-content: space-around;
  align-items: center;
}
.paixu span {
  color: rgba(0, 0, 0, 0.859);
}
.remai {
  margin-top: 10px;
  display: flex;
  justify-content: space-around;
  align-items: center;
  width: 100%;
  height: 30px;
  // background-color: aqua;
  text-align: center;
}
.remai span {
  width: 21%;
  height: 30px;
  border-radius: 5px;
  background-color: rgba(128, 128, 128, 0.186);
  line-height: 30px;
  font-size: 15px;
}

.shopping {
  margin: 20px 0;
  widows: 100%;
  height: 130px;
  // background-color: aqua;
  display: flex;
}
.im {
  width: 30%;
  height: 130px;
  // background-color: pink;
  margin-right: 15px;
}
.wen {
  margin-top: 6px;
}
.wen span {
  font-size: 12px;
  padding-right: 5px;
  color: gray;
}
.chaofan {
  border-radius: 5px;
  margin-top: 18px;
  width: 100px;
  height: 20px;
  background-color: #ffead0;
  color: #ff6a00;
  font-size: 12px;
  line-height: 20px;
  text-align: center;
  margin-right: 10px;
}
.chao {
  display: flex;
}
</style>